#!/usr/bin/env sh
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
sudo yabai --load-sa

# mission-control desktop labels
yabai -m space 1 --label code
yabai -m space 2 --label web
yabai -m space 3 --label social
yabai -m space 4 --label media
yabai -m space 5 --label notes
yabai -m space 6 --label mail

# window rules
yabai -m rule --add app="^Kitty$"               code

yabai -m rule --add app="^Chrome$"              web
yabai -m rule --add app="^Safari$"              web

yabai -m rule --add app="^QQ$"                  manage=off
yabai -m rule --add app="^图片查看器$"          manage=off
yabai -m rule --add app="^WeChat$"              manage=off
yabai -m rule --add app="^System Preferences$"  manage=off
yabai -m rule --add app="^licecap$"             manage=off
yabai -m rule --add app="^Finder$"              manage=off
yabai -m rule --add app="^PhotoShop$"           manage=off

# global settings
yabai -m config                              \
    external_bar                off:41:0     \
    mouse_follows_focus         on           \
    focus_follows_mouse         autoraise    \
    window_placement            second_child \
    window_topmost              off          \
    window_shadow               off          \
    window_animation_duration   0.25         \
    window_opacity_duration     0.25         \
    active_window_opacity       1.00         \
    normal_window_opacity       0.50         \
    window_opacity              on           \
    insert_feedback_color       0xaad75f5f   \
    window_border_width         2            \
    split_ratio                 0.50         \
    split_type                  auto         \
    auto_balance                off          \
    top_padding                 10           \
    left_padding                10           \
    right_padding               10           \
    bottom_padding              10           \
    window_gap                  10           \
    layout                      bsp          \
    mouse_modifier              fn           \
    mouse_action1               move         \
    mouse_action2               resize       \
    mouse_drop_action           swap

echo "yabai configuration loaded.."
